# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 183
n 183(None)[del _[1]
[](hdmiresolution_dict.items())
Menu.__init__(self, name, choices=modes_list, type=type, universe='audio')
]:
	i: 0(AF), 131()
	o: 

nname: 131
n 131(None)[]:
	i: 0(for)
	o: 183()

nname: 0
n 0(None)[self.eventhandler = FailsafeMenuEventHandler(self)
modes_list = [ActionItem(_('576i/50Hz'), type_='action', action=self.valid_mode, args=[(720, 576, 1, 50), 'rgb']), ActionItem(_('480i/60Hz'), type_='action', action=self.valid_mode, args=[(720, 480, 1, 59), 'rgb'])]
]:
	i: 
	o: 131(for), 183(AF)

nname: 183
n 183(None)[del _[1]
[](hdmiresolution_dict.items())
Menu.__init__(self, name, choices=modes_list, type=type, universe='audio')
]:
	i: 0(AF), 0(for)
	o: 

nname: 0
n 0(None)[self.eventhandler = FailsafeMenuEventHandler(self)
modes_list = [ActionItem(_('576i/50Hz'), type_='action', action=self.valid_mode, args=[(720, 576, 1, 50), 'rgb']), ActionItem(_('480i/60Hz'), type_='action', action=self.valid_mode, args=[(720, 480, 1, 59), 'rgb'])]
]:
	i: 
	o: 183(AF)

self.nodes: {0: <unpyclib.structure.node instance at 0xb7756dcc>, 183: <unpyclib.structure.node instance at 0xb7756ecc>}
nname: 48
n 48(None)[]:
	i: 33(), 47()
	o: 

nname: 47
n 47(None)[]:
	i: 0(f)
	o: 48()

nname: 33
n 33(None)[self.switch_mode()
]:
	i: 0(t)
	o: 48()

nname: 0
n 0(ret is not False)[ret = Menu.select(self, item, list_name)
]:
	i: 
	o: 33(t), 47(f)

nname: 0
n 0(None)[ret = Menu.select(self, item, list_name)
if ret is not False:
	self.switch_mode()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb775654c>}
nname: 0
n 0(None)[Menu.show(self, hide_previous_menu)
Task(self.switch_mode).start(0.5)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb77567ac>}
nname: 0
n 0(None)[pygui_globs['videomodes'].handle_events = True
Menu.hide(self)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb775648c>}
nname: 92
n 92(None)[w, h, interlaced, freq = resolution
log.debug('Setting resolution to %s', resolution)
display = pygui_globs['display']
display.set_resolution((w, h), interlaced, freq)
]:
	i: 44(), 74(), 91()
	o: 

nname: 91
n 91(None)[]:
	i: 61(f)
	o: 92()

nname: 74
n 74(None)[os.system('/sbin/stfbset -e yuv -d rgb -e cvbs')
]:
	i: 61(t)
	o: 92()

nname: 61
n 61(component == 'yuv')[]:
	i: 0(f)
	o: 74(t), 91(f)

nname: 44
n 44(None)[os.system('/sbin/stfbset -d yuv -e rgb -e cvbs')
]:
	i: 0(t)
	o: 92()

nname: 0
n 0(component == 'rgb')[resolution = self.selected.args[0]
component = self.selected.args[1]
]:
	i: 
	o: 44(t), 61(f)

nname: 0
n 0(None)[resolution = self.selected.args[0]
component = self.selected.args[1]
if component == 'rgb':
	os.system('/sbin/stfbset -d yuv -e rgb -e cvbs')
else:
	if component == 'yuv':
		os.system('/sbin/stfbset -e yuv -d rgb -e cvbs')
w, h, interlaced, freq = resolution
log.debug('Setting resolution to %s', resolution)
display = pygui_globs['display']
display.set_resolution((w, h), interlaced, freq)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7756ccc>}
nname: 102
n 102(None)[config.user_config.save()
self.hide()
]:
	i: 80(), 101()
	o: 

nname: 101
n 101(None)[]:
	i: 68(f)
	o: 102()

nname: 80
n 80(None)[config.user_config['connections']['composite_output'] = 'ntsc'
]:
	i: 68(t)
	o: 102()

nname: 68
n 68(mode == (720, 480, 1, 59))[]:
	i: 46(), 67()
	o: 80(t), 101(f)

nname: 67
n 67(None)[]:
	i: 0(f)
	o: 68()

nname: 46
n 46(None)[config.user_config['connections']['composite_output'] = 'pal'
]:
	i: 0(t)
	o: 68()

nname: 0
n 0(mode == (720, 576, 1, 50))[config.user_config['connections']['component_output'] = component
config.user_config['connections']['resolution'] = mode
]:
	i: 
	o: 46(t), 67(f)

nname: 102
n 102(None)[config.user_config.save()
self.hide()
]:
	i: 0()
	o: 

nname: 0
n 0(None)[config.user_config['connections']['component_output'] = component
config.user_config['connections']['resolution'] = mode
if mode == (720, 576, 1, 50):
	config.user_config['connections']['composite_output'] = 'pal'
if mode == (720, 480, 1, 59):
	config.user_config['connections']['composite_output'] = 'ntsc'
]:
	i: 
	o: 102()

nname: 0
n 0(None)[config.user_config['connections']['component_output'] = component
config.user_config['connections']['resolution'] = mode
if mode == (720, 576, 1, 50):
	config.user_config['connections']['composite_output'] = 'pal'
if mode == (720, 480, 1, 59):
	config.user_config['connections']['composite_output'] = 'ntsc'
config.user_config.save()
self.hide()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7756d4c>}
nname: 0
n 0(None)[self.selected.execute()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb775628c>}
nname: 6
n 6(None)[__doc__ = '\n    Allow the user to try all the supported videomodes en find one\n    that he can use.\n    '
def __init__(self, name='Failsafe menu', eventhandler=None, type='failsafe', universe=None):
	self.eventhandler = FailsafeMenuEventHandler(self)
	modes_list = [ActionItem(_('576i/50Hz'), type_='action', action=self.valid_mode, args=[(720, 576, 1, 50), 'rgb']), ActionItem(_('480i/60Hz'), type_='action', action=self.valid_mode, args=[(720, 480, 1, 59), 'rgb'])]

def select(self, item, list_name=None, force_select=False):
	ret = Menu.select(self, item, list_name)
	if ret is not False:
		self.switch_mode()

def show(self, hide_previous_menu=True):
	Menu.show(self, hide_previous_menu)
	Task(self.switch_mode).start(0.5)

def hide(self):
	pygui_globs['videomodes'].handle_events = True
	Menu.hide(self)

def switch_mode(self):
	resolution = self.selected.args[0]
	component = self.selected.args[1]
	if component == 'rgb':
		os.system('/sbin/stfbset -d yuv -e rgb -e cvbs')
	else:
		if component == 'yuv':
			os.system('/sbin/stfbset -e yuv -d rgb -e cvbs')
	w, h, interlaced, freq = resolution
	log.debug('Setting resolution to %s', resolution)
	display = pygui_globs['display']
	display.set_resolution((w, h), interlaced, freq)

def valid_mode(self, mode, component):
	config.user_config['connections']['component_output'] = component
	config.user_config['connections']['resolution'] = mode
	if mode == (720, 576, 1, 50):
		config.user_config['connections']['composite_output'] = 'pal'
	if mode == (720, 480, 1, 59):
		config.user_config['connections']['composite_output'] = 'ntsc'
	config.user_config.save()
	self.hide()

def execute_selected(self):
	self.selected.execute()

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb7752f6c>}
nname: 0
n 0(None)[from __future__ import absolute_import
__all__ = ['FailsafeMenu']
import os
from peewee.messages import send as louie_send
from peewee.debug import GET_LOGGER
from peewee.notifier import Task
from pygui.eventmanager.menus import FailsafeMenuEventHandler
from pygui.shared import pygui_globs
from pygui.menu.menu import Menu
from pygui.item.core import ActionItem
from pygui.facilities.codemapping import hdmiresolution_dict
import pygui.config as config
log = GET_LOGGER(__name__)
class FailsafeMenu(Menu):
	__doc__ = '\n    Allow the user to try all the supported videomodes en find one\n    that he can use.\n    '
	def __init__(self, name='Failsafe menu', eventhandler=None, type='failsafe', universe=None):
		self.eventhandler = FailsafeMenuEventHandler(self)
		modes_list = [ActionItem(_('576i/50Hz'), type_='action', action=self.valid_mode, args=[(720, 576, 1, 50), 'rgb']), ActionItem(_('480i/60Hz'), type_='action', action=self.valid_mode, args=[(720, 480, 1, 59), 'rgb'])]

	def select(self, item, list_name=None, force_select=False):
		ret = Menu.select(self, item, list_name)
		if ret is not False:
			self.switch_mode()

	def show(self, hide_previous_menu=True):
		Menu.show(self, hide_previous_menu)
		Task(self.switch_mode).start(0.5)

	def hide(self):
		pygui_globs['videomodes'].handle_events = True
		Menu.hide(self)

	def switch_mode(self):
		resolution = self.selected.args[0]
		component = self.selected.args[1]
		if component == 'rgb':
			os.system('/sbin/stfbset -d yuv -e rgb -e cvbs')
		else:
			if component == 'yuv':
				os.system('/sbin/stfbset -e yuv -d rgb -e cvbs')
		w, h, interlaced, freq = resolution
		log.debug('Setting resolution to %s', resolution)
		display = pygui_globs['display']
		display.set_resolution((w, h), interlaced, freq)

	def valid_mode(self, mode, component):
		config.user_config['connections']['component_output'] = component
		config.user_config['connections']['resolution'] = mode
		if mode == (720, 576, 1, 50):
			config.user_config['connections']['composite_output'] = 'pal'
		if mode == (720, 480, 1, 59):
			config.user_config['connections']['composite_output'] = 'ntsc'
		config.user_config.save()
		self.hide()

	def execute_selected(self):
		self.selected.execute()



]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb774988c>}
from __future__ import absolute_import
__all__ = ['FailsafeMenu']
import os
from peewee.messages import send as louie_send
from peewee.debug import GET_LOGGER
from peewee.notifier import Task
from pygui.eventmanager.menus import FailsafeMenuEventHandler
from pygui.shared import pygui_globs
from pygui.menu.menu import Menu
from pygui.item.core import ActionItem
from pygui.facilities.codemapping import hdmiresolution_dict
import pygui.config as config
log = GET_LOGGER(__name__)
class FailsafeMenu(Menu):
	__doc__ = '\n    Allow the user to try all the supported videomodes en find one\n    that he can use.\n    '
	def __init__(self, name='Failsafe menu', eventhandler=None, type='failsafe', universe=None):
		self.eventhandler = FailsafeMenuEventHandler(self)
		modes_list = [ActionItem(_('576i/50Hz'), type_='action', action=self.valid_mode, args=[(720, 576, 1, 50), 'rgb']), ActionItem(_('480i/60Hz'), type_='action', action=self.valid_mode, args=[(720, 480, 1, 59), 'rgb'])]

	def select(self, item, list_name=None, force_select=False):
		ret = Menu.select(self, item, list_name)
		if ret is not False:
			self.switch_mode()

	def show(self, hide_previous_menu=True):
		Menu.show(self, hide_previous_menu)
		Task(self.switch_mode).start(0.5)

	def hide(self):
		pygui_globs['videomodes'].handle_events = True
		Menu.hide(self)

	def switch_mode(self):
		resolution = self.selected.args[0]
		component = self.selected.args[1]
		if component == 'rgb':
			os.system('/sbin/stfbset -d yuv -e rgb -e cvbs')
		else:
			if component == 'yuv':
				os.system('/sbin/stfbset -e yuv -d rgb -e cvbs')
		w, h, interlaced, freq = resolution
		log.debug('Setting resolution to %s', resolution)
		display = pygui_globs['display']
		display.set_resolution((w, h), interlaced, freq)

	def valid_mode(self, mode, component):
		config.user_config['connections']['component_output'] = component
		config.user_config['connections']['resolution'] = mode
		if mode == (720, 576, 1, 50):
			config.user_config['connections']['composite_output'] = 'pal'
		if mode == (720, 480, 1, 59):
			config.user_config['connections']['composite_output'] = 'ntsc'
		config.user_config.save()
		self.hide()

	def execute_selected(self):
		self.selected.execute()



